// API配置文件
// 根据环境自动选择不同的API地址

interface ApiConfig {
  baseUrl: string
  tencentFace: string
  zjxFace: string
  timeout: number
}

// 开发环境配置
const devConfig: ApiConfig = {
  baseUrl: 'http://47.86.15.86:3000/',
  tencentFace: 'http://47.86.15.86:3000/api/tencent',
  zjxFace: 'http://47.86.15.86:3000/zjx',
  timeout: 30000
}

// 生产环境配置
const prodConfig: ApiConfig = {
  baseUrl: 'https://your-production-domain.com',
  tencentFace: 'https://your-production-domain.com/api/tencent',
  zjxFace: 'https://your-production-domain.com/zjx',
  timeout: 30000
}

// 测试环境配置
const testConfig: ApiConfig = {
  baseUrl: 'https://your-test-domain.com',
  tencentFace: 'https://your-test-domain.com/api/tencent',
  zjxFace: 'https://your-test-domain.com/zjx',
  timeout: 30000
}

// 根据环境变量选择配置
const getApiConfig = (): ApiConfig => {
  const env = process.env.NODE_ENV || 'development'
  
  switch (env) {
    case 'production':
      return prodConfig
    case 'test':
      return testConfig
    case 'development':
    default:
      return devConfig
  }
}

// 导出配置
export const apiConfig = getApiConfig()

// 导出常用配置
export const API_BASE_URL = apiConfig.baseUrl
export const TENCENT_FACE_API = apiConfig.tencentFace
export const ZJX_FACE_API = apiConfig.zjxFace
export const API_TIMEOUT = apiConfig.timeout

// 导出环境信息
export const isDevelopment = process.env.NODE_ENV === 'development'
export const isProduction = process.env.NODE_ENV === 'production'
export const isTest = process.env.NODE_ENV === 'test'
